<script src="assets/js/go.js"></script>
<script src="pages/js/meta_eva_wbal_chart.js"></script>
<script type="text/javascript">
$(document).ready(function () {
	var selectStr = "chartName=" + label_eva_wbal_chart_chartName + "&" + "companyId=" + label_water_bala_companyId;
	console.log(selectStr);
	$.ajax({
		type:'get',
		url:"/wbalchart/selectOne?" + selectStr,
		success:function(data){
			document.getElementById("flowchart_name").value = label_eva_wbal_chart_chartName;
			if(data['result'] != null){
				var id=data['result']['id'];
				var chartName=data['result']['chartName'];
				var _data=data['result']['data'];
				myDiagram.model = go.Model.fromJson(_data);
				loadDiagramProperties(); // 在Model.modelData被带入内存后执行此操作
				document.getElementById("flowchart_name").value = chartName;
			}
		},
	    error: function(){
	          alert("错误");
	      }
	})
})
</script>

<div id="sample">
	<div class="input-group"
		style="margin: 10px 10px 20px; width: 320px; position: absolute">
		<span class="input-group-addon">水平衡图名称</span> <input type="text" readOnly="true"
			id="flowchart_name" class="form-control">
	</div>
	<div id="toolbar" class="btn-group" style="margin: 10px 370px 20px">
		<button id="SaveButton" type="button" class="btn btn-default"
			onclick="save()">
			<span class="glyphicon glyphicon-saved" aria-hidden="true"></span>保存
		</button>
	
		<button id="btn_out" type="button" class="btn btn-default">
			<span class="glyphicon glyphicon-log-out"
				aria-hidden="true"></span>退出
		</button>
	</div>

	<div style="width: 100%; white-space: nowrap;">

		<span style="display: inline-block; vertical-align: top; width: 150px">
			<div id="myPaletteDiv" style="border: solid 1px black; height: 800px"></div>
		</span> <span style="display: inline-block; vertical-align: top; width: 90%">
			<div id="myDiagramDiv" style="border: solid 1px black; height: 800px"></div>
		</span> 
	</div>
	<div>
		<textarea id="mySavedModel"
			style="width: 100%; height: 50px; display: none">
{ "class": "go.GraphLinksModel",
  "linkFromPortIdProperty": "fromPort",
  "linkToPortIdProperty": "toPort",
  "nodeDataArray": [
 ],
  "linkDataArray": [
 ]}
    </textarea>
	</div>
</div>